package com.lxw.study.behavioral.memento.case1;

/**
 * 发起人类
 */
public class Originator {
    private String state;

    void setState(String state) {
        this.state = state;
    }

    String getState() {
        return state;
    }

    // 创建备忘录
    Memento createMemento() {
        return new Memento(state);
    }

    // 恢复状态
    void restoreMemento(Memento memento) {
        this.state = memento.getState();
    }
}
